package ru.fizteh.fivt.demo.calc;

import ru.fizteh.fivt.demo.ntypes.*;
import Ice.LocalObjectImpl;
import Ice.Object;

// Factory of all Class types instances, especially those sent as RPC parameters !
public class MyNumberObjectFactory extends LocalObjectImpl implements Ice.ObjectFactory {

	public Object create(String type) {
      if(type.equals(MyNumber.ice_staticId()))
      {
          return new MyNumber();
      }

      if(type.equals(MyNumberFloat.ice_staticId()))
      {
          return new MyNumberFloat();
      }

      if(type.equals(MyNumberString.ice_staticId()))
      {
          return new MyNumberString();
      }

//      if(type.equals(MyNumberFormatException.ice_staticId()))
//      {
//          return new MyNumberString();
//      }

      assert(false);
      return null;
	}

	public void destroy() {
		// TODO Auto-generated method stub

	}

}
